class Solution:
    def poorPigs(self, buckets: int, minutesToDie: int, minutesToTest: int) -> int:
        times = minutesToTest // minutesToDie
        base = times + 1
        pigs = 0
        val = 1
        while val < buckets:
            val = val * base
            pigs += 1
        return pigs
if __name__ == '__main__':
    buckets = 1000
    minutesToDie = 15
    minutesToTest = 60
    print(Solution().poorPigs(buckets, minutesToDie, minutesToTest))
# 思路：
# 最小猪的数量 = 能表示的状态数要覆盖所有桶
# 每只猪有 times + 1 种状态：
# 在第 1 次检测死了
# 在第 2 次检测死了
# ……
# 完成所有测试还活着
# 要求：(times+1) ** pigs >= buckets